134. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2020-08-14 00:01:36 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

134.1 Files compared

#LocationFileLast Modified
1Porto v3.2.3/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/viewlayer.js2018-11-13 00:34:06 +0000
2Porto v3.2.4/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Mageplaza_AjaxLayer/web/js/viewlayer.js2020-08-12 02:04:02 +0000

134.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged4768
Changed319
Inserted00
Removed00

134.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

134.4 Active regular expressions

No regular expressions were active.

134.5 Comparison detail

1 /** 1 /**
2  * Mageplaza 2  * Mageplaza
3  * 3  *
4  * NOTICE OF LICENSE 4  * NOTICE OF LICENSE
5  * 5  *
6  * This source file is subject to the Mageplaza.com license that is 6  * This source file is subject to the Mageplaza.com license that is
7  * available through the world-wide-web at this URL: 7  * available through the world-wide-web at this URL:
8  * https://www.mageplaza.com/LICENSE.txt 8  * https://www.mageplaza.com/LICENSE.txt
9  * 9  *
10  * DISCLAIMER 10  * DISCLAIMER
11  * 11  *
12  * Do not edit or add to this file if you wish to upgrade this extension to newer 12  * Do not edit or add to this file if you wish to upgrade this extension to newer
13  * version in the future. 13  * version in the future.
14  * 14  *
15  * @category    Mageplaza 15  * @category    Mageplaza
16  * @package     Mageplaza_AjaxLayer 16  * @package     Mageplaza_AjaxLayer
17  * @copyright   Copyright (c) Mageplaza (http://www.mageplaza.com/) 17  * @copyright   Copyright (c) Mageplaza (http://www.mageplaza.com/)
18  * @license     https://www.mageplaza.com/LICENSE.txt 18  * @license     https://www.mageplaza.com/LICENSE.txt
19  */ 19  */
20  20 
21 define([ 21 define([
22     'jquery', 22     'jquery',
23     'Mageplaza_AjaxLayer/js/action/submit-filter', 23     'Mageplaza_AjaxLayer/js/action/submit-filter',
24     'Magento_Catalog/js/price-utils', 24     'Magento_Catalog/js/price-utils',
25     'jquery/ui', 25     'jquery/ui',
26     'accordion', 26     'accordion',
27     'productListToolbarForm' 27     'productListToolbarForm'
28 ], function ($, submitFilterAction, ultil) { 28 ], function ($, submitFilterAction, ultil) {
29     "use strict"; 29     "use strict";
30     var next_page = ""; 30     var next_page = "";
31     var loading = false; 31     var loading = false;
32     var infinite_loaded_count = 0; 32     var infinite_loaded_count = 0;
33     var active = false; 33     var active = false;
34  34 
35     $.widget('mageplaza.layer', $.mage.accordion, { 35     $.widget('mageplaza.layer', $.mage.accordion, {
36         options: { 36         options: {
37             openedState: 'active', 37             openedState: 'active',
38             collapsible: true, 38             collapsible: true,
39             multipleCollapsible: true, 39             multipleCollapsible: true,
40             animate: 200, 40             animate: 200,
41             productsListSelector: '#layer-product-list', 41             productsListSelector: '#layer-product-list',
42             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]', 42             mobileShopbyElement: '#layered-filter-block .filter-title [data-role=title]',
43             collapsibleElement: '[data-role=ln_collapsible]', 43             collapsibleElement: '[data-role=ln_collapsible]',
44             header: '[data-role=ln_title]', 44             header: '[data-role=ln_title]',
45             content: '[data-role=ln_content]', 45             content: '[data-role=ln_content]',
46             isCustomerLoggedIn: false, 46             isCustomerLoggedIn: false,
47             params: [], 47             params: [],
48             active: [] 48             active: []
49         }, 49         },
50          50 
51         inFinite: function() { 51         inFinite: function() {
52             var self = this; 52             var self = this;
53             next_page = ""; 53             next_page = "";
54             if($(self.options.productsListSelector +' .infinite-loader').length > 0){ 54             if($(self.options.productsListSelector +' .infinite-loader').length > 0){
55                 active = true; 55                 active = true;
56             } 56             }
57             $(".pages-items li > a.next").each(function(){ 57             $(".pages-items li > a.next").each(function(){
58                 next_page = $(this).attr("href"); 58                 next_page = $(this).attr("href");
59             }); 59             });
60             if(!next_page){ 60             if(!next_page){
61                 $('.infinite-loader').hide(); 61                 $('.infinite-loader').hide();
62             } 62             }
63             $(".infinite-loader .btn-load-more").click(function(){ 63             $(".infinite-loader .btn-load-more").click(function(){
64                 if(!loading && next_page){ 64                 if(!loading && next_page){
65                     loading = true; 65                     loading = true;
66                     self.ajaxInfinite(next_page); 66                     self.ajaxInfinite(next_page);
67                 } 67                 }
68             }); 68             });
69         }, 69         },
70  70 
71         ajaxInfinite: function (submitUrl) { 71         ajaxInfinite: function (submitUrl) {
72             var self = this; 72             var self = this;
73             infinite_loaded_count++; 73             infinite_loaded_count++;
74             $('.infinite-loader .btn-load-more').hide(); 74             $('.infinite-loader .btn-load-more').hide();
75             $('.infinite-loader .loading').show(); 75             $('.infinite-loader .loading').show();
76             $.ajax({ 76             $.ajax({
77                 url: submitUrl, 77                 url: submitUrl,
78                 type: 'get', 78                 type: 'get',
79                 beforeSend: function () { 79                 beforeSend: function () {
80                     $('.infinite-loader .btn-load-more').hide(); 80                     $('.infinite-loader .btn-load-more').hide();
81                     $('.infinite-loader .loading').show(); 81                     $('.infinite-loader .loading').show();
82                 }, 82                 },
83                 success: function (res) { 83                 success: function (res) {
84                     loading = false; 84                     loading = false;
85                     var $products = $(res.products); 85                     var $products = $(res.products);
86                     if (res.backUrl) { 86                     if (res.backUrl) {
87                         window.location = res.backUrl; 87                         window.location = res.backUrl;
88                         return; 88                         return;
89                     } 89                     }
90                     if($products){ 90                     if($products){
91                         $products.each(function(i,el){ 91                         $products.each(function(i,el){
92                             if($(el).hasClass('products-grid')){ 92                             if($(el).hasClass('products-grid')){
93                                 var items_grid = $(this).find('.product-items .item'); 93                                 var items_grid = $(this).find('.product-items .item');
94                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid); 94                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_grid);
95                                 $(self.options.productsListSelector).trigger('contentUpdated'); 95                                 $(self.options.productsListSelector).trigger('contentUpdated');
96                             } 96                             }
97                             if($(el).hasClass('products-list')){ 97                             if($(el).hasClass('products-list')){
98                                 var items_list = $(this).find('.product-items .item'); 98                                 var items_list = $(this).find('.product-items .item');
99                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list); 99                                 $(self.options.productsListSelector + ' .products.wrapper .product-items').append(items_list);
100                                 $(self.options.productsListSelector).trigger('contentUpdated'); 100                                 $(self.options.productsListSelector).trigger('contentUpdated');
101                             } 101                             }
102                             if($(el).hasClass('toolbar-products')){ 102                             if($(el).hasClass('toolbar-products')){
103                                 if($(this).find('.pages a.next').length > 0){ 103                                 if($(this).find('.pages a.next').length > 0){
104                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href')); 104                                     $(self.options.productsListSelector + ' .pages a.next').attr('href', $(this).find('.pages a.next').attr('href'));
105                                 }else{ 105                                 }else{
106                                     $(self.options.productsListSelector + ' .pages a.next').remove(); 106                                     $(self.options.productsListSelector + ' .pages a.next').remove();
107                                 } 107                                 }
108                             } 108                             }
109                         }); 109                         });
110                         if($("form[data-role=tocart-form]").length > 0) { 110                         if($("form[data-role=tocart-form]").length > 0) {
111                             $("form[data-role=tocart-form]").catalogAddToCart(); 111                             $("form[data-role=tocart-form]").catalogAddToCart();
112                         } 112                         }
113                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n'); 113                         $('.main .products.grid .product-items li.product-item:nth-child(2n)').addClass('nth-child-2n');
114                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1'); 114                         $('.main .products.grid .product-items li.product-item:nth-child(2n+1)').addClass('nth-child-2np1');
115                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n'); 115                         $('.main .products.grid .product-items li.product-item:nth-child(3n)').addClass('nth-child-3n');
116                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1'); 116                         $('.main .products.grid .product-items li.product-item:nth-child(3n+1)').addClass('nth-child-3np1');
117                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n'); 117                         $('.main .products.grid .product-items li.product-item:nth-child(4n)').addClass('nth-child-4n');
118                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1'); 118                         $('.main .products.grid .product-items li.product-item:nth-child(4n+1)').addClass('nth-child-4np1');
119                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n'); 119                         $('.main .products.grid .product-items li.product-item:nth-child(5n)').addClass('nth-child-5n');
120                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1'); 120                         $('.main .products.grid .product-items li.product-item:nth-child(5n+1)').addClass('nth-child-5np1');
121                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n'); 121                         $('.main .products.grid .product-items li.product-item:nth-child(6n)').addClass('nth-child-6n');
122                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1'); 122                         $('.main .products.grid .product-items li.product-item:nth-child(6n+1)').addClass('nth-child-6np1');
123                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n'); 123                         $('.main .products.grid .product-items li.product-item:nth-child(7n)').addClass('nth-child-7n');
124                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1'); 124                         $('.main .products.grid .product-items li.product-item:nth-child(7n+1)').addClass('nth-child-7np1');
125                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n'); 125                         $('.main .products.grid .product-items li.product-item:nth-child(8n)').addClass('nth-child-8n');
126                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1'); 126                         $('.main .products.grid .product-items li.product-item:nth-child(8n+1)').addClass('nth-child-8np1');
127                         var hist = submitUrl; 127                         var hist = submitUrl;
128                         if(submitUrl.indexOf("p=") > -1){ 128                         if(submitUrl.indexOf("p=") > -1){
129                             var len = submitUrl.length-submitUrl.indexOf("p="); 129                             var len = submitUrl.length-submitUrl.indexOf("p=");
130                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len); 130                             var str_temp = submitUrl.substr(submitUrl.indexOf("p="),len);
131                             var page_param = ""; 131                             var page_param = "";
132                             if(str_temp.indexOf("&") == -1){ 132                             if(str_temp.indexOf("&") == -1){
133                                 page_param = str_temp; 133                                 page_param = str_temp;
134                             } else { 134                             } else {
135                                 page_param = str_temp.substr(0,str_temp.indexOf("&")); 135                                 page_param = str_temp.substr(0,str_temp.indexOf("&"));
136                             } 136                             }
137                             hist = submitUrl.replace(page_param, ""); 137                             hist = submitUrl.replace(page_param, "");
138                         } 138                         }
139                         if (typeof window.history.pushState === 'function') { 139                         if (typeof window.history.pushState === 'function') {
140                             window.history.pushState({url: hist}, '', hist); 140                             window.history.pushState({url: hist}, '', hist);
141                         } 141                         }
142                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 142                         if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
143                             requirejs(['jquery', 'weltpixel_quickview' ], 143                             requirejs(['jquery', 'weltpixel_quickview' ],
144                                 function($, quickview) { 144                                 function($, quickview) {
145                                     $('.weltpixel-quickview').off('click').on('click', function() { 145                                     $('.weltpixel-quickview').off('click').on('click', function() {
146                                         var prodUrl = $(this).attr('data-quickview-url'); 146                                         var prodUrl = $(this).attr('data-quickview-url');
147                                         if (prodUrl.length) { 147                                         if (prodUrl.length) {
148                                             quickview.displayContent(prodUrl); 148                                             quickview.displayContent(prodUrl);
149                                         } 149                                         }
150                                     }); 150                                     });
151                                 }); 151                                 });
152                         } 152                         }
153                         $(".products-grid .weltpixel-quickview").each(function(){ 153                         $(".products-grid .weltpixel-quickview").each(function(){
154                             $(this).appendTo($(this).parent().parent().children(".product-item-photo")); 154                             $(this).appendTo($(this).parent().parent().children(".product-item-photo"));
155                         }); 155                         });
156                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 156                         $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
157                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 157                         if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
158                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() { 158                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('initialized.owl.carousel', function() {
159                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 159                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
160                             }); 160                             });
161                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 161                             $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
162                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 162                                 $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
163                             }); 163                             });
164                         } 164                         }
165                         next_page = ""; 165                         next_page = "";
166                         $(".pages-items li > a.next").each(function(){ 166                         $(".pages-items li > a.next").each(function(){
167                             next_page = $(this).attr("href"); 167                             next_page = $(this).attr("href");
168                         }); 168                         });
169                         $('.infinite-loader .loading').hide(); 169                         $('.infinite-loader .loading').hide();
170                         if(next_page){ 170                         if(next_page){
171                             $('.infinite-loader .btn-load-more').show(); 171                             $('.infinite-loader .btn-load-more').show();
172                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){ 172                             $(".infinite-loader .btn-load-more").unbind("click").click(function(){
173                                 if(!loading && next_page){ 173                                 if(!loading && next_page){
174                                     loading = true; 174                                     loading = true;
175                                     self.ajaxInfinite(next_page); 175                                     self.ajaxInfinite(next_page);
176                                 } 176                                 }
177                             }); 177                             });
178                         } 178                         }
179                     } 179                     }
180  180 
181                 }, 181                 },
182                 error: function () { 182                 error: function () {
183                     window.location.reload(); 183                     window.location.reload();
184                 } 184                 }
185             }); 185             });
186         }, 186         },
187  187 
188         _create: function () { 188         _create: function () {
189             this.initActiveItems(); 189             this.initActiveItems();
190  190 
191             this._super(); 191             this._super();
192  192 
193             this.initProductListUrl(); 193             this.initProductListUrl();
194             this.initObserve(); 194             this.initObserve();
195             this.initWishlistCompare(); 195             this.initWishlistCompare();
196         }, 196         },
197  197 
198         initActiveItems: function () { 198         initActiveItems: function () {
199             var layerActives = this.options.active, 199             var layerActives = this.options.active,
200                 actives = []; 200                 actives = [];
201  201 
202             if (typeof window.layerActiveTabs !== 'undefined') { 202             if (typeof window.layerActiveTabs !== 'undefined') {
203                 layerActives = window.layerActiveTabs; 203                 layerActives = window.layerActiveTabs;
204             } 204             }
205             if (layerActives.length) { 205             if (layerActives.length) {
206                 this.element.find('.filter-options-item').each(function (index) { 206                 this.element.find('.filter-options-item').each(function (index) {
207                     if (~$.inArray($(this).attr('attribute'), layerActives)) { 207                     if (~$.inArray($(this).attr('attribute'), layerActives)) {
208                         actives.push(index); 208                         actives.push(index);
209                     } 209                     }
210                 }); 210                 });
211             } 211             }
212  212 
213             this.options.active = actives; 213             this.options.active = actives;
214  214 
215             return this; 215             return this;
216         }, 216         },
217  217 
218         initProductListUrl: function () { 218         initProductListUrl: function () {
219             var isProcessToolbar = false; 219             var isProcessToolbar = false;
220             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) { 220             $.mage.productListToolbarForm.prototype.changeUrl = function (paramName, paramValue, defaultValue) {
221                 if (isProcessToolbar) { 221                 if (isProcessToolbar) {
222                     return; 222                     return;
223                 } 223                 }
224                 isProcessToolbar = true; 224                 isProcessToolbar = true;
225  225 
226                 var urlPaths = this.options.url.split('?'), 226                 var urlPaths = this.options.url.split('?'),
227                     baseUrl = urlPaths[0], 227                     baseUrl = urlPaths[0],
228                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [], 228                     urlParams = urlPaths[1] ? urlPaths[1].split('&') : [],
229                     paramData = {}, 229                     paramData = {},
230                     parameters; 230                     parameters;
231                 for (var i = 0; i < urlParams.length; i++) { 231                 for (var i = 0; i < urlParams.length; i++) {
232                     parameters = urlParams[i].split('='); 232                     parameters = urlParams[i].split('=');
233                     paramData[parameters[0]] = parameters[1] !== undefined 233                     paramData[parameters[0]] = parameters[1] !== undefined
234                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20')) 234                         ? window.decodeURIComponent(parameters[1].replace(/\+/g, '%20'))
235                         : ''; 235                         : '';
236                 } 236                 }
237                 paramData[paramName] = paramValue; 237                 paramData[paramName] = paramValue;
238                 if (paramValue === defaultValue) { 238                 if (paramValue === defaultValue) {
239                     delete paramData[paramName]; 239                     delete paramData[paramName];
240                 } 240                 }
241                 paramData = $.param(paramData); 241                 paramData = $.param(paramData);
242                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : '')); 242                 submitFilterAction(baseUrl + (paramData.length ? '?' + paramData : ''));
243             } 243             }
244         }, 244         },
245  245 
246         initObserve: function () { 246         initObserve: function () {
247             var self = this; 247             var self = this;
248             infinite_loaded_count = 0; 248             infinite_loaded_count = 0;
249             
 249 
    250             // fix browser back, forward button
    251             if (typeof window.history.replaceState === "function") {
    252                 window.history.replaceState({url: document.URL}, document.title);
    253 
    254                 setTimeout(function () {
    255                     window.onpopstate = function (e) {
    256                         if (e.state) {
    257                             submitFilterAction(e.state.url, 1);
    258                         }
    259                     };
    260                 }, 0)
    261             }
    262 
250             var pageElements = $('#layer-product-list').find('.pages a'); 263             var pageElements = $('#layer-product-list').find('.pages a');
251             pageElements.each(function () { 264             pageElements.each(function () {
252                 var el = $(this), 265                 var el = $(this),
253                     link = self.checkUrl(el.prop('href')); 266                     link = self.checkUrl(el.prop('href'));
254                 if (!link) { 267                 if (!link) {
255                     return; 268                     return;
256                 } 269                 }
257  270 
258                 el.bind('click', function (e) { 271                 el.bind('click', function (e) {
259                     submitFilterAction(link); 272                     submitFilterAction(link);
260                     e.stopPropagation(); 273                     e.stopPropagation();
261                     e.preventDefault(); 274                     e.preventDefault();
262                 }) 275                 })
263             }); 276             });
264  277 
265             var currentElements = this.element.find('.filter-current a, .filter-actions a'); 278             var currentElements = this.element.find('.filter-current a, .filter-actions a');
266             currentElements.each(function (index) { 279             currentElements.each(function (index) {
267                 var el = $(this), 280                 var el = $(this),
268                     link = self.checkUrl(el.prop('href')); 281                     link = self.checkUrl(el.prop('href'));
269                 if (!link) { 282                 if (!link) {
270                     return; 283                     return;
271                 } 284                 }
272  285 
273                 el.bind('click', function (e) { 286                 el.bind('click', function (e) {
274                     submitFilterAction(link); 287                     submitFilterAction(link);
275                     e.stopPropagation(); 288                     e.stopPropagation();
276                     e.preventDefault(); 289                     e.preventDefault();
277                 }); 290                 });
278             }); 291             });
279  292 
280             var optionElements = this.element.find('.filter-options a'); 293             var optionElements = this.element.find('.filter-options a');
281             optionElements.each(function (index) { 294             optionElements.each(function (index) {
282                 var el = $(this), 295                 var el = $(this),
283                     link = self.checkUrl(el.prop('href')); 296                     link = self.checkUrl(el.prop('href'));
284                 if (!link) { 297                 if (!link) {
285                     return; 298                     return;
286                 } 299                 }
287  300 
288                 el.bind('click', function (e) { 301                 el.bind('click', function (e) {
289                     if (el.hasClass('swatch-option-link-layered')) { 302                     if (el.hasClass('swatch-option-link-layered')) {
290                         self.selectSwatchOption(el); 303                         self.selectSwatchOption(el);
291                     } 304                     }
292  305 
293                     self.ajaxSubmit(link); 306                     self.ajaxSubmit(link);
294                     e.stopPropagation(); 307                     e.stopPropagation();
295                     e.preventDefault(); 308                     e.preventDefault();
296                 }); 309                 });
297             }); 310             });
298  311 
299             var swatchElements = this.element.find('.swatch-attribute'); 312             var swatchElements = this.element.find('.swatch-attribute');
300             swatchElements.each(function (index) { 313             swatchElements.each(function (index) {
301                 var el = $(this); 314                 var el = $(this);
302                 var attCode = el.attr('attribute-code'); 315                 var attCode = el.attr('attribute-code');
303                 if (attCode) { 316                 if (attCode) {
304                     if (self.options.params.hasOwnProperty(attCode)) { 317                     if (self.options.params.hasOwnProperty(attCode)) {
305                         var attValues = self.options.params[attCode].split(","); 318                         var attValues = self.options.params[attCode].split(",");
306                         var swatchOptions = el.find('.swatch-option'); 319                         var swatchOptions = el.find('.swatch-option');
307                         swatchOptions.each(function (option) { 320                         swatchOptions.each(function (option) {
308                             var elOption = $(this); 321                             var elOption = $(this);
309                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) { 322                             if ($.inArray(elOption.attr('option-id'), attValues) !== -1) {
310                                 elOption.addClass('selected'); 323                                 elOption.addClass('selected');
311                             } 324                             }
312                         }); 325                         });
313                     } 326                     }
314                 } 327                 }
315             }); 328             });
316              329 
317             if(typeof enable_quickview != 'undefined' && enable_quickview == true) { 330             if(typeof enable_quickview != 'undefined' && enable_quickview == true) {
318                 requirejs(['jquery', 'weltpixel_quickview' ], 331                 requirejs(['jquery', 'weltpixel_quickview' ],
319                     function($, quickview) { 332                     function($, quickview) {
320                         $('.weltpixel-quickview').off('click').on('click', function() { 333                         $('.weltpixel-quickview').off('click').on('click', function() {
321                             var prodUrl = $(this).attr('data-quickview-url'); 334                             var prodUrl = $(this).attr('data-quickview-url');
322                             if (prodUrl.length) { 335                             if (prodUrl.length) {
323                                 quickview.displayContent(prodUrl); 336                                 quickview.displayContent(prodUrl);
324                             } 337                             }
325                         }); 338                         });
326                     }); 339                     });
327             } 340             }
328  341 
329             $(".products-grid .weltpixel-quickview").each(function(){ 342             $(".products-grid .weltpixel-quickview").each(function(){
330                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo")); 343                 $(this).appendTo($(this).parents('.product-item-info').children(".product-item-photo"));
331             }); 344             });
332             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"}); 345             $("#layer-product-list img.porto-lazyload:not(.porto-lazyload-loaded)").lazyload({effect:"fadeIn"});
333             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) { 346             if ($('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').length) {
334                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() { 347                 $('#layer-product-list .porto-lazyload:not(.porto-lazyload-loaded)').closest('.owl-carousel').on('changed.owl.carousel', function() {
335                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear'); 348                     $(this).find('.porto-lazyload:not(.porto-lazyload-loaded)').trigger('appear');
336                 }); 349                 });
337             } 350             }
338             self.inFinite(); 351             self.inFinite();
339         }, 352         },
340  353 
341         selectSwatchOption: function (el) { 354         selectSwatchOption: function (el) {
342             var childEl = el.find('.swatch-option'); 355             var childEl = el.find('.swatch-option');
343             if (childEl.hasClass('selected')) { 356             if (childEl.hasClass('selected')) {
344                 childEl.removeClass('selected'); 357                 childEl.removeClass('selected');
345             } else { 358             } else {
346                 childEl.addClass('selected'); 359                 childEl.addClass('selected');
347             } 360             }
348         }, 361         },
349  362 
350         ajaxSubmit: function (submitUrl) { 363         ajaxSubmit: function (submitUrl) {
351             this.element.find(this.options.mobileShopbyElement).trigger('click'); 364             this.element.find(this.options.mobileShopbyElement).trigger('click');
352  365 
353             return submitFilterAction(submitUrl); 366             return submitFilterAction(submitUrl);
354         }, 367         },
355  368 
356         checkUrl: function (url) { 369         checkUrl: function (url) {
357             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/; 370             var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
358  371 
359             return regex.test(url) ? url : null; 372             return regex.test(url) ? url : null;
360         }, 373         },
361  374 
362         //Handling 'add to wishlist' & 'add to compare' event 375         //Handling 'add to wishlist' & 'add to compare' event
363         initWishlistCompare: function () { 376         initWishlistCompare: function () {
364             var isCustomerLoggedIn = this.options.isCustomerLoggedIn, 377             var isCustomerLoggedIn = this.options.isCustomerLoggedIn,
365                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : ''); 378                 elClass = 'a.action.tocompare' + (isCustomerLoggedIn ? ',a.action.towishlist' : '');
366             $(elClass).each(function () { 379             $(elClass).each(function () {
367                 var el = $(this); 380                 var el = $(this);
368                 $(el).bind('click', function (e) { 381                 $(el).bind('click', function (e) {
369                     var dataPost = $(el).data('post'), 382                     var dataPost = $(el).data('post'),
370                         formKey = $('input[name="form_key"]').val(); 383                         formKey = $('input[name="form_key"]').val();
371                     if (formKey) { 384                     if (formKey) {
372                         dataPost.data.form_key = formKey; 385                         dataPost.data.form_key = formKey;
373                     } 386                     }
374  387 
375                     var paramData = $.param(dataPost.data), 388                     var paramData = $.param(dataPost.data),
376                         url = dataPost.action + (paramData.length ? '?' + paramData : ''); 389                         url = dataPost.action + (paramData.length ? '?' + paramData : '');
377  390 
378                     submitFilterAction(url, true); 391                     submitFilterAction(url, true);
379                     e.stopPropagation(); 392                     e.stopPropagation();
380                     e.preventDefault(); 393                     e.preventDefault();
381                 }); 394                 });
382             }) 395             })
383         } 396         }
384     }); 397     });
385  398 
386     return $.mageplaza.layer; 399     return $.mageplaza.layer;
387 }); 400 });